import request from '@/utils/request'
import { praseStrEmpty } from "@/utils/ruoyi";

// 查询公众号列表
export function publicList(data) {
  return request({
    url: '/salary-wechat-backend/offiaccount/list',
    method: 'post',
    data: data
  })
}
export function offiaccountListDetail(data) {
  return request({
    url: '/salary-wechat-backend/offiaccount/list/detail',
    method: 'post',
    data: data
  })
}
// 公众号导出用户
export function offiaccountExport(data) {
  return request({
    url: '/salary-wechat-backend/offiaccount/list/detail/export',
    method: 'post',
    responseType: "blob",
    data: data
  })
}
// 发送邮件提醒配置域名和H5邮件
export function offiaccountSendEmail(id) {
  return request({
    url: '/salary-wechat-backend/offiaccount/sendEmail/' + id,
    method: 'get'
  })
}
// 确认安全域名和业务地址已配置成功
export function offiaccountBuildStatus(id) {
  return request({
    url: '/salary-wechat-backend/offiaccount/update/buildStatus/' + id,
    method: 'put'
  })
}
// 转存txt文件至静态资源服务器
export function saveToRemote(id) {
  return request({
    url: '/salary-wechat-backend/offiaccount/file/saveToRemote?id=' + id,
    method: 'get'
  })
}
// 删除公众号（逻辑删除）
export function offiaccountDelete(data) {
  return request({
    url: '/salary-wechat-backend/offiaccount/list/delete',
    method: 'post',
    data: data
  })
}

// 新增公众号
export function offiaccountListAdd(data) {
  return request({
    url: '/salary-wechat-backend/offiaccount/list/add',
    method: 'post',
    data: data
  })
}
// 编辑公众号
export function offiaccountListEdit(data) {
  return request({
    url: '/salary-wechat-backend/offiaccount/list/edit',
    method: 'post',
    data: data
  })
}

export function offiaccountListInfo(id) {
  const data = {
    id
  }
  return request({
    url: '/salary-wechat-backend/offiaccount/list/info',
    method: 'post',
    data: data
  })
}


// 客户企业全部下拉列表
export function getCompanyTreeSelect() {
  return request({
    url: '/salary-wechat-backend/company/tree/select',
    method: 'get'
  })
}
// 查询客户企业对应的公众号下拉选择列表
export function offiaccountList(companyId) {
  return request({
    url: '/salary-wechat-backend/offiaccount/list/' + companyId,
    method: 'get'
  })
}
// 新建中台用户
export function addSwmuser(data) {
  return request({
    url: '/salary-wechat-backend/swmuser/save',
    method: 'post',
    data: data
  })
}

// 更新中台用户 关联的公众号列表
export function updateSwmuser(data) {
  return request({
    url: '/salary-wechat-backend/swmuser/update',
    method: 'post',
    data: data
  })
}



// 中台用户详情
export function swmuserDetail(query) {
  return request({
    url: '/salary-wechat-backend/swmuser/detail',
    method: 'get',
    params: query
  })
}
// 用户列表
export function swmuserList(query) {
  return request({
    url: '/salary-wechat-backend/swmuser/list',
    method: 'get',
    params: query
  })
}


// 删除中台用户
export function delSwmuser(query) {
  return request({
    url: '/salary-wechat-backend/swmuser/delete',
    method: 'post',
    params: query
  })
}